 package com.cxl.pattern.singleton;
 
 import java.util.HashMap;
 import java.util.Map;
 
 public class SingletonReg
 {
   private static Map<String, SingletonReg> m_registry = new HashMap();
 
   static
   {
     SingletonReg x = new SingletonReg();
     m_registry.put(x.getClass().getName(), x);
   }
 
   public static SingletonReg getInstance(String name)
   {
     if (name == null) {
       name = "SingletonReg";
     }
     if (m_registry.get(name) == null) {
       try {
         m_registry.put(name, (SingletonReg)Class.forName(name).newInstance());
       }
       catch (InstantiationException e) {
         e.printStackTrace();
       }
       catch (IllegalAccessException e) {
         e.printStackTrace();
       }
       catch (ClassNotFoundException e) {
         e.printStackTrace();
       }
     }
     return (SingletonReg)m_registry.get(name);
   }
 }

/* Location:           E:\work\eclipse3.6_\workspace\design_pattern\
 * Qualified Name:     com.cxl.pattern.singleton.SingletonReg
 * JD-Core Version:    0.6.1
 */